#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5+5;
int n,tmp;
struct node{
	int x,y;
	inline friend bool operator < (node x,node y)
	{
		if(x.x==y.x) return x.y<y.y;
		return x.x<y.x;
	}
}a[N];
int f[N],s[N],mx;
namespace sub1{
	inline void main()
	{
		int p = 0,las = 0;
		for(int i = 1;i<=n;i++)
		{
			f[i] = s[i-1]+((a[i].y+tmp-1)/tmp-1)*a[i].x;
			for(int j = 1;j<i;j++)
				f[i] = min(f[j]+s[i-1]-s[j]+((a[i].y+a[j].x-1)/a[j].x-1)*a[i].x,f[i]);
		}
		cout<<f[n];
	}
}
namespace sub2{
	int p[N],cnt;
	inline void upd(int x,int y)
	{
		if(x==0) return;
		f[y] = min(f[y],f[x]+s[y-1]-s[x]+((a[y].y-1)/a[x].x)*a[y].x);
	}
	inline void main()
	{
		int lim = 1e8/n;
		int pp = 0;
		for(int i = 1;i<=n;i++)
		{
			int w = s[i-1]+((a[i].y+tmp-1)/tmp-1)*a[i].x;
			f[i] = w;
			for(int j = 1;j<=min(lim,cnt);j++) upd(p[j],i);
			for(int j = max(cnt-lim,1ll);j<=cnt;j++) upd(p[j],i);
			upd(pp,i);
			if(a[i].x!=a[i-1].x) p[++cnt] = i;
			if(f[i]==w) pp = i;
		}
		cout<<f[n];
	}
}
signed main()
{
	freopen("xinyue.in","r",stdin);
	freopen("xinyue.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>n>>tmp;
	for(int i = 1;i<=n;i++) cin>>a[i].x>>a[i].y,mx = max(mx,a[i].x);
	sort(a+1,a+n+1);
	for(int i = 1;i<=n;i++) s[i] = s[i-1]+((a[i].y+mx-1)/mx-1)*a[i].x;
	if(n<=3000) sub1::main();
	else sub2::main();
	return 0;
}

